/**
 * 
 */
package edu.avans.hartigehap.service.jpa;

import java.util.Collection;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.google.common.collect.Lists;

import edu.avans.hartigehap.domain.Ingredient;
import edu.avans.hartigehap.domain.MenuItem;
//import edu.avans.hartigehap.domain.decorator.PizzaBasic;
import edu.avans.hartigehap.repository.IngredientRepository;
import edu.avans.hartigehap.service.PizzaService;

/**
 * @author Chris
 *
 */

@Service("pizzaService")
@Repository
@Transactional

public class PizzaServiceImpl implements PizzaService
{
	final Logger logger = LoggerFactory.getLogger(PizzaServiceImpl.class);
	
	@Autowired
	private IngredientRepository ingredientRepository;

//	@Override
//	public List<PizzaBasic> findAllPizza() {
//		// TODO Auto-generated method stub
//		return null;
//	}
//	
//	@Override
//	public PizzaBasic findPizzaById(Long id) {
//		// TODO Auto-generated method stub
//		return null;
//	}
	
	@Override
	public List<Ingredient> findAllIngredient() {
		// TODO Auto-generated method stub
		return Lists.newArrayList(ingredientRepository.findAll());
	}

	@Override
	public Ingredient findIngredientById(String name) {
		// TODO Auto-generated method stub
		return ingredientRepository.findOne(name);
	}

	@Override
	public Ingredient save(Ingredient ingredient) {
		// TODO Auto-generated method stub
		return ingredientRepository.save(ingredient);
	}

	@Override
	public void delete(String ingredient) {
		// TODO Auto-generated method stub
		ingredientRepository.delete(ingredient);
		
	}

	/*@Override
	public MenuItem decorator(MenuItem pizza, Ingredient ingredient) 
	{
		// TODO Auto-generated method stub
		Collection<Ingredient> ingredients = pizza.getIngredients();
		ingredients.add(ingredient);
		
		return pizza;
	}*/

}
